//
//  UserCenterViewController.m
//  HuateVideo
//
//  Created by  on 12-5-27.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "UserCenterViewController.h"
@interface UserCenterViewController ()

@end

@implementation UserCenterViewController
@synthesize  type;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    UILabel* redText=[[UILabel alloc] initWithFrame:CGRectMake(65, 40, 230, 30)];
    redText.textColor=[UIColor redColor];
    redText.backgroundColor=[UIColor clearColor];
    redText.text=LS(@"请输入正确邮箱或手机号");
    [self.view addSubview:redText];
    [redText release];
    
    UILabel* user=[[UILabel alloc] initWithFrame:CGRectMake(20, 70, 40, 20)];
    user.text=LS(@"帐号:");
    user.textColor=[UIColor whiteColor];
    user.backgroundColor=[UIColor clearColor];
    [self.view addSubview:user];
    [user release];
    
    UITextField* username=[[UITextField alloc] initWithFrame:CGRectMake(65, 70, 230, 20)];
    username.placeholder=LS(@"请输入正确邮箱或手机号");
    username.font=[UIFont systemFontOfSize:14];
    username.borderStyle=UITextBorderStyleRoundedRect;
    [self.view addSubview:username];
    [username release];
    
    
    UILabel* pwd=[[UILabel alloc] initWithFrame:CGRectMake(20, 110, 40, 20)];
    pwd.text=LS(@"密码:");
    pwd.textColor=[UIColor whiteColor];
    pwd.backgroundColor=[UIColor clearColor];
    [self.view addSubview:pwd];
    [pwd release];
    
    UITextField* userpwd=[[UITextField alloc] initWithFrame:CGRectMake(65, 110, 230, 20)];
    userpwd.placeholder=LS(@"请输入密码");
    userpwd.font=[UIFont systemFontOfSize:14];
    userpwd.borderStyle=UITextBorderStyleRoundedRect;
    [self.view addSubview:userpwd];
    [userpwd release];
    
    UIButton*res=[UIButton buttonWithType:UIButtonTypeCustom];
    res.tag=111;
    [res setBackgroundImage:[UIImage imageNamed:@"sizianniu.png"] forState:UIControlStateNormal];
    [self.view addSubview:res];

    UIButton* changBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    changBtn.titleLabel.font=[UIFont systemFontOfSize:14];
    [changBtn addTarget:self action:@selector(checkType) forControlEvents:UIControlEventTouchUpInside];
    changBtn.tag=222;
    [self.view addSubview:changBtn];
    [self loginAddition];
    [self checkType];
}

-(void)loginAddition{
    UIView* loginInfo=[[UIView alloc] initWithFrame:CGRectMake(65, 140, 200, 20)];
    loginInfo.tag=1000;
    loginInfo.backgroundColor=[UIColor clearColor];
    [self.view addSubview:loginInfo];
    [loginInfo release];
    
    UIButton* check1=[UIButton buttonWithType:UIButtonTypeCustom];
    check1.frame=CGRectMake(0, 0, 15, 15);
    check1.backgroundColor=LIGHT_COLOR;
    [loginInfo addSubview:check1];
    
    UILabel* l1=[[UILabel alloc] initWithFrame:CGRectMake(20, 0, 50, 15)];
    l1.text=LS(@"记住密码");
    l1.textColor=[UIColor whiteColor];
    l1.adjustsFontSizeToFitWidth=YES;
    l1.backgroundColor=[UIColor clearColor];
    [loginInfo addSubview:l1];
    [l1 release];
    
    UIButton* check2=[UIButton buttonWithType:UIButtonTypeCustom];
    check2.frame=CGRectMake(75, 0, 15, 15);
    check2.backgroundColor=LIGHT_COLOR;
    [loginInfo addSubview:check2];
    
    UILabel* l2=[[UILabel alloc] initWithFrame:CGRectMake(95, 0, 50, 15)];
    l2.text=LS(@"自动登录");
    l2.textColor=[UIColor whiteColor];
    l2.adjustsFontSizeToFitWidth=YES;
    l2.backgroundColor=[UIColor clearColor];
    [loginInfo addSubview:l2];
    [l2 release];

}
-(void)checkType{
    UIButton* res=(UIButton*)[self.view viewWithTag:111];
    UIView* v=(UIView*)[self.view viewWithTag:1000];
    UIButton* changBtn=(UIButton*)[self.view viewWithTag:222];
    if (type) {     
        v.alpha=0;
        self.title=LS(@"注册");
        res.frame=CGRectMake(65, 140, 75, 25);
        [res setTitle:LS(@"注册") forState:UIControlStateNormal];
        changBtn.frame=CGRectMake(150, 140, 150, 25);
        [changBtn setTitle:LS(@"已有账号,点击登录") forState:UIControlStateNormal];

    }else {
        v.alpha=1;
        self.title=LS(@"登录");
        res.frame=CGRectMake(65, 180, 75, 25);
        [res setTitle:LS(@"登录") forState:UIControlStateNormal];
        changBtn.frame=CGRectMake(150, 180, 150, 25);
        [changBtn setTitle:LS(@"无账号,点击注册") forState:UIControlStateNormal];
    }
    type=!type;

}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
